"use strict";

// 引入报错信息
const httpCode = require("./httpCode");

module.exports = {
    sendRes(ctx , {code = 200 , data = {} , msg = ''} = {}) {
        // 成功的结果
        if(code === 200)
        {
            ctx.body = {
                code: 'SUCCESS',
                msg: msg || 'success',
                status: code,
                data,
            }
            return;
        }
        ctx.status = code,
        ctx.body = {
            code: 'FAIL',
            msg: msg || httpCode[code],
            status: code,
            data,
        }
    }
}